<?php

namespace app\admin\validate\chat;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class ConsultingOptionsServer
 * @package app\admin\validate\chat
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 * @see \app\admin\controller\chat\ConsultingOptionsServer
 */
class ConsultingOptionsServer extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'	=> 'isId',
		'userId'	=> 'integer|egt:0|max:11',
		'serverType'	=> 'integer|egt:0|max:3',
		'isChatFreely'	=> 'integer|max:1',
		'chatFreelyDuration'	=> 'integer|max:11',
		'questionsNum'	=> 'integer|egt:0|max:10',
		'isShowCallTel'	=> 'integer|max:1',
		'showCallTelDuration'	=> 'integer|max:11',
		'icon'	=> 'scalar|max:200',
		'name'	=> 'scalar|max:60',
		'showPrice'	=> 'numeric',
		'price'	=> 'numeric',
		'subsidy'	=> 'numeric',
		'desc1'	=> 'scalar|max:200',
		'desc2'	=> 'scalar|max:200',
		'desc3'	=> 'scalar|max:200',
		'maxTimes'	=> 'integer|egt:0|max:10',
		'recommendServerId'	=> 'integer|egt:0|max:10',
		'ord'	=> 'integer|egt:0|max:5',
		'updated'	=> 'integer|egt:0|max:11',
		'created'	=> 'integer|egt:0|max:11',
        'page'      => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id'	=> 'id',
		'userId'	=> 'userId',
		'serverType'	=> 'serverType',
		'isChatFreely'	=> 'isChatFreely',
		'chatFreelyDuration'	=> 'chatFreelyDuration',
		'questionsNum'	=> 'questionsNum',
		'isShowCallTel'	=> 'isShowCallTel',
		'showCallTelDuration'	=> 'showCallTelDuration',
		'icon'	=> 'icon',
		'name'	=> 'name',
		'showPrice'	=> 'showPrice',
		'price'	=> 'price',
		'subsidy'	=> 'subsidy',
		'desc1'	=> 'desc1',
		'desc2'	=> 'desc2',
		'desc3'	=> 'desc3',
		'maxTimes'	=> 'maxTimes',
		'recommendServerId'	=> 'recommendServerId',
		'ord'	=> 'ord',
		'updated'	=> 'updated',
		'created'	=> 'created',
        'page'      => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require'	=> '缺少:attribute',
		'id.isId'	=> '请设置正确的:attribute',
		'userId.require'	=> '请输入:attribute',
		'userId.integer' => ':attribute应该是整数',
		'userId.egt'	=> ':attribute应该大于等于:rule',
		'userId.max'	=> ':attribute长度不能超过:rule位',
		'serverType.require'	=> '请输入:attribute',
		'serverType.integer' => ':attribute应该是整数',
		'serverType.egt'	=> ':attribute应该大于等于:rule',
		'serverType.max'	=> ':attribute长度不能超过:rule位',
		'isChatFreely.require'	=> '请输入:attribute',
		'isChatFreely.integer' => ':attribute应该是整数',
		'isChatFreely.max'	=> ':attribute长度不能超过:rule位',
		'chatFreelyDuration.require'	=> '请输入:attribute',
		'chatFreelyDuration.integer' => ':attribute应该是整数',
		'chatFreelyDuration.max'	=> ':attribute长度不能超过:rule位',
		'questionsNum.require'	=> '请输入:attribute',
		'questionsNum.integer' => ':attribute应该是整数',
		'questionsNum.egt'	=> ':attribute应该大于等于:rule',
		'questionsNum.max'	=> ':attribute长度不能超过:rule位',
		'isShowCallTel.require'	=> '请输入:attribute',
		'isShowCallTel.integer' => ':attribute应该是整数',
		'isShowCallTel.max'	=> ':attribute长度不能超过:rule位',
		'showCallTelDuration.require'	=> '请输入:attribute',
		'showCallTelDuration.integer' => ':attribute应该是整数',
		'showCallTelDuration.max'	=> ':attribute长度不能超过:rule位',
		'icon.require'	=> '请输入:attribute',
		'icon.scalar' => ':attribute应该是字符串',
		'icon.max'	=> ':attribute长度不能超过:rule位',
		'name.require'	=> '请输入:attribute',
		'name.scalar' => ':attribute应该是字符串',
		'name.max'	=> ':attribute长度不能超过:rule位',
		'showPrice.require'	=> '请输入:attribute',
		'showPrice.numeric' => ':attribute应该是数字',
		'price.require'	=> '请输入:attribute',
		'price.numeric' => ':attribute应该是数字',
		'subsidy.require'	=> '请输入:attribute',
		'subsidy.numeric' => ':attribute应该是数字',
		'desc1.require'	=> '请输入:attribute',
		'desc1.scalar' => ':attribute应该是字符串',
		'desc1.max'	=> ':attribute长度不能超过:rule位',
		'desc2.require'	=> '请输入:attribute',
		'desc2.scalar' => ':attribute应该是字符串',
		'desc2.max'	=> ':attribute长度不能超过:rule位',
		'desc3.require'	=> '请输入:attribute',
		'desc3.scalar' => ':attribute应该是字符串',
		'desc3.max'	=> ':attribute长度不能超过:rule位',
		'maxTimes.require'	=> '请输入:attribute',
		'maxTimes.integer' => ':attribute应该是整数',
		'maxTimes.egt'	=> ':attribute应该大于等于:rule',
		'maxTimes.max'	=> ':attribute长度不能超过:rule位',
		'recommendServerId.require'	=> '请输入:attribute',
		'recommendServerId.integer' => ':attribute应该是整数',
		'recommendServerId.egt'	=> ':attribute应该大于等于:rule',
		'recommendServerId.max'	=> ':attribute长度不能超过:rule位',
		'ord.require'	=> '请输入:attribute',
		'ord.integer' => ':attribute应该是整数',
		'ord.egt'	=> ':attribute应该大于等于:rule',
		'ord.max'	=> ':attribute长度不能超过:rule位',
		'updated.require'	=> '请输入:attribute',
		'updated.integer' => ':attribute应该是整数',
		'updated.egt'	=> ':attribute应该大于等于:rule',
		'updated.max'	=> ':attribute长度不能超过:rule位',
		'created.require'	=> '请输入:attribute',
		'created.integer' => ':attribute应该是整数',
		'created.egt'	=> ':attribute应该大于等于:rule',
		'created.max'	=> ':attribute长度不能超过:rule位',
        'page.require'      => '请输入:attribute',
        'page.integer'      => ':attribute应该是整数',
        'page.egt'          => ':attribute应该大于等于:rule',
        'page.max'          => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt'     => ':attribute应该大于等于:rule',
        'page_size.max'     => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index'  => ['page', 'page_size'],
        'read'   => ['id' => 'require'],
        'save'   => ['userId', 'serverType', 'isChatFreely', 'chatFreelyDuration', 'questionsNum', 'isShowCallTel', 'showCallTelDuration', 'icon', 'name', 'showPrice', 'price', 'subsidy', 'desc1', 'desc2', 'desc3', 'maxTimes', 'recommendServerId', 'ord', 'updated', 'created'],
    ];

}
